package com.enterprise.struts2.aboutus;

import java.util.Map;

import org.apache.struts2.interceptor.ParameterAware;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.SessionAware;

import com.enterprise.daoImpl.AboutusDaoImpl;
import com.enterprise.domain.Aboutus;
import com.opensymphony.xwork2.ActionSupport;

public class AboutusAction extends ActionSupport implements SessionAware,RequestAware,ParameterAware {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int Aboutusorder;
	private String Title;
	private String content;
	private int ID;
	private Map<String, Object> sessionMap;
	private Map<String, Object> requestMap;
	public int getAboutusorder() {
		return Aboutusorder;
	}

	public void setAboutusorder(int aboutusorder) {
		Aboutusorder = aboutusorder;
	}

	public String getTitle() {
		return Title;
	}

	public int getID() {
		return ID;
	}

	public void setID(int iD) {
		ID = iD;
	}

	public void setTitle(String title) {
		Title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	private AboutusDaoImpl aboutusDaoImpl=new AboutusDaoImpl();
	
	public String add(){
	
		Aboutus aboutus=new Aboutus(1, Aboutusorder, Title, content);
		aboutusDaoImpl.addAboutus(aboutus);
		return "success";
	}
	public String delete(){
	
		Aboutus aboutus=new Aboutus(ID, Aboutusorder, Title, content);
		aboutusDaoImpl.deleteAboutus(aboutus);
		return "success";
	}
	
	public String update(){
	
		Aboutus aboutus=new Aboutus(ID, Aboutusorder, Title, content);
		aboutusDaoImpl.updateAboutus(aboutus);
		return "success";
		
	}
	
	public String query(){
		
		Aboutus aboutus=new Aboutus(1, Aboutusorder, Title, content);
		requestMap.put("Aboutus", (Aboutus)aboutusDaoImpl.getAboutus(Title));
		return "success";
	}

	@Override
	public void setSession(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		sessionMap=arg0;
	}

	@Override
	public void setRequest(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		requestMap=arg0;
	}
	private Map<String,String[]> parametersMap;
	@Override
	public void setParameters(Map<String, String[]> arg0) {
		// TODO Auto-generated method stub
		parametersMap=arg0;
		
	}

	public AboutusAction() {
		super();
		// TODO Auto-generated constructor stub
		
	}
	
	
}
